from sqlmodel import SQLModel, Field, Column, Integer, String, DateTime
from datetime import datetime


class DeptTable(SQLModel, table=True):
    __tablename__ = "dept"  # 指定数据库表名

    id: int = Field(
        default=None,
        sa_column=Column("id", Integer, primary_key=True, index=True),
    )
    name: str = Field(sa_column=Column("name", String, index=True))
    createTime: datetime = Field(
        default_factory=datetime.now,
        sa_column=Column("create_time", DateTime, default=datetime.now),
    )
    updateTime: datetime = Field(
        default_factory=datetime.now,
        sa_column=Column("update_time", DateTime, default=datetime.now),
    )
